#ifndef _KERNEL_DEFS_H_
#define _KERNEL_DEFS_H_

// System call IDs
#define HARDWARE_INTERRUPT      0xFF
#define SYSCALL_CREATE          0
#define SYSCALL_MY_TID          1
#define SYSCALL_MY_PARENT_TID   2
#define SYSCALL_PASS            3
#define SYSCALL_EXIT            4
#define SYSCALL_FINGER_OF_DEATH 5
#define SYSCALL_SEND            6
#define SYSCALL_RECEIVE         7
#define SYSCALL_REPLY           8
#define SYSCALL_REGISTER_AS     9
#define SYSCALL_WHO_IS          10
#define SYSCALL_AWAIT_EVENT     11
#define SYSCALL_DELAY           12
#define SYSCALL_TIME            13
#define SYSCALL_DELAY_UNTIL     14
#define SYSCALL_GETC            15
#define SYSCALL_PUTC            16
#define SYSCALL_PARAM_TEST      17

// Event types
#define EVENT_NONE          -1
#define EVENT_TIMER         0
#define EVENT_UART1_RX      1
#define EVENT_UART1_TX      2
#define EVENT_UART2_RX      3
#define EVENT_UART2_TX      4
#define EVENT_MAX           5

// Task thread states
#define STATE_DEFUNCT       0
#define STATE_READY         1
#define STATE_ACTIVE        2
#define STATE_SEND_BLOCK    3
#define STATE_RECEIVE_BLOCK 4
#define STATE_REPLY_BLOCK   5
#define STATE_EVENT_BLOCK   6

// Common errors
#define SUCCESS										0
#define ERROR_NULL_POINTER				-10

// Constants
#define MAX_TASKS     50
#define MAX_PRI       10
#define MAX_NAME_LEN  20

#define CODE_BASE 0x218000 // address where kernel is loaded
#define STACK_SIZE 0x20000 // 128 kB

// NULL pointer
#define NULL 0

// Booleans
#define TRUE  1
#define FALSE 0

// Interrupt modes
#define SWI 0
#define IRQ 1

#endif
